package com.eclipse.e0112_多线程.聊天_0113晨考;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
	private static int port = 8081;

	public static void main(String[] args) throws IOException {

		ServerSocket serverSocket = new ServerSocket(port);
		System.out.println("服务器等待接收信息");
		Socket socket = serverSocket.accept();

		InputStream inputStream = socket.getInputStream();
		BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));

		String info = null;
		while (true) {
			info = in.readLine();
			if (info.equals("88")) {
				in.close();
				socket.close();
			}
			System.out.println("服务器收到信息:" + info);
		}

	}
}
